// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request';
// 定义 API 路径枚举
enum Api {
    SysDictDataPage = '/SysDictValue/pages',
    SysDictDataAdd = '/SysDictValue/addData',
    SysDictDataUpdate = '/SysDictValue/updateData',
    SysDictDataDelete = '/SysDictValue/deleteData',
    SysDictDataDataListCode = '/SysDictValue/dataList/{code}',
    SysDictDataDataList = '/SysDictValue/dataList',
    SysDictDataDetail = '/SysDictValue/detail',
    SysDictDataList = '/SysDictValue/list',
    SysDictDataSetStatus = '/SysDictValue/setStatus',
}

// 增加字典值
export const apiSysDictDataAddPost = (body: any) =>
    request({
        url: Api.SysDictDataAdd,
        method: 'post',
        data: body,
    });

// 根据字典类型编码获取字典值集合
export const apiSysDictDataDataListCodeGet = (code: string) =>
    request({
        url: Api.SysDictDataDataListCode.replace('{code}', code),
        method: 'get',
    });

// 根据查询条件获取字典值集合
export const apiSysDictDataDataListGet = (code: string, status?: number) =>
    request({
        url: Api.SysDictDataDataList,
        method: 'get',
        params: { Code: code, Status: status },
    });

// 删除字典值
export const apiSysDictDataDeletePost = (body: any) =>
    request({
        url: Api.SysDictDataDelete,
        method: 'post',
        data: body,
    });

// 获取字典值详情
export const apiSysDictDataDetailGet = (id: number, status?: any) =>
    request({
        url: Api.SysDictDataDetail,
        method: 'get',
        params: { Id: id, Status: status },
    });

// 获取字典值列表
export const apiSysDictDataListGet = (dictTypeId: number) =>
    request({
        url: Api.SysDictDataList,
        method: 'get',
        params: { DictTypeId: dictTypeId },
    });

// 获取字典值分页列表
export const apiSysDictDataPagePost = (body: any) =>
    request({
        url: Api.SysDictDataPage,
        method: 'get',
        data: body,
    });

// 修改字典值状态
export const apiSysDictDataSetStatusPost = (body: any) =>
    request({
        url: Api.SysDictDataSetStatus,
        method: 'post',
        data: body,
    });

// 更新字典值
export const apiSysDictDataUpdatePost = (body: any) =>
    request({
        url: Api.SysDictDataUpdate,
        method: 'put',
        data: body,
    });